package com.uzai.console.web.app;

import com.uzai.console.dto.app.base.AppBaseInfoDto;
import com.uzai.console.service.app.AppBaseService;
import com.uzai.console.vo.app.base.AppBaseInfoVo;
import com.uzai.console.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Api(value = "APP基础设置",tags = "APP基础设置")
@RestController
@RequestMapping(value = "/app")
public class AppBaseController extends BaseController {
    private Logger logger = LoggerFactory.getLogger(AppBaseController.class);

    @Autowired
    private AppBaseService appBaseService;


    @ApiOperation(value = "查询app基础设置信息", notes = "查询app基础设置信息", response = AppBaseInfoVo.class)
    @PostMapping("/queryAppBaseInfo")
    public Object queryAppBaseInfo(){
     return appBaseService.queryAppBaseInfo(getLoginInfo().getMerId());
    }


    @ApiOperation(value = "修改app基础设置信息", notes = "修改app基础设置信息", response = boolean.class)
    @PostMapping("/updateAppBaseInfo")
    public Object updateAppBaseInfo(@RequestBody AppBaseInfoDto appBaseInfoDto){
        appBaseService.updateAppBaseInfo(appBaseInfoDto);
        return true;
    }

    @ApiOperation(value = "app复制cms基础设置信息", notes = "复制cms基础设置信息", response = AppBaseInfoVo.class)
    @PostMapping("/copyCmsBaseInfo")
    public Object copyCmsBaseInfo(){
        return appBaseService.copyCmsBaseInfo(getLoginInfo().getMerId());
    }
}
